package work.shyk.msf.json;

import com.alibaba.fastjson.JSON;
import work.shyk.msf.json.model.JsonApplications;

/**
 * description: <br>
 * createTime: 2019/9/1115:35 <br>
 *
 * @author zzh
 */
public class Main {

    public static void main(String[] args) {
        JsonApplications jsonApplications = JSON.parseObject("{\n" +
                "    \"applications\": {\n" +
                "        \"versions__delta\": \"1\",\n" +
                "        \"apps__hashcode\": \"UP_1_\",\n" +
                "        \"application\": [\n" +
                "            {\n" +
                "                \"name\": \"TEST\",\n" +
                "                \"instance\": [\n" +
                "                    {\n" +
                "                        \"instanceId\": \"USER-20171205YQ:test:8082\",\n" +
                "                        \"hostName\": \"USER-20171205YQ\",\n" +
                "                        \"app\": \"TEST\",\n" +
                "                        \"ipAddr\": \"10.238.148.87\",\n" +
                "                        \"status\": \"UP\",\n" +
                "                        \"overriddenStatus\": \"UNKNOWN\",\n" +
                "                        \"port\": {\n" +
                "                            \"$\": 8082,\n" +
                "                            \"@enabled\": \"true\"\n" +
                "                        },\n" +
                "                        \"securePort\": {\n" +
                "                            \"$\": 443,\n" +
                "                            \"@enabled\": \"false\"\n" +
                "                        },\n" +
                "                        \"countryId\": 1,\n" +
                "                        \"dataCenterInfo\": {\n" +
                "                            \"@class\": \"com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo\",\n" +
                "                            \"name\": \"MyOwn\"\n" +
                "                        },\n" +
                "                        \"leaseInfo\": {\n" +
                "                            \"renewalIntervalInSecs\": 30,\n" +
                "                            \"durationInSecs\": 90,\n" +
                "                            \"registrationTimestamp\": 1568186715011,\n" +
                "                            \"lastRenewalTimestamp\": 1568187014168,\n" +
                "                            \"evictionTimestamp\": 0,\n" +
                "                            \"serviceUpTimestamp\": 1568186713973\n" +
                "                        },\n" +
                "                        \"metadata\": {\n" +
                "                            \"cluster\": \"default\"\n" +
                "                        },\n" +
                "                        \"homePageUrl\": \"http://USER-20171205YQ:8082/\",\n" +
                "                        \"statusPageUrl\": \"http://USER-20171205YQ:8082/info\",\n" +
                "                        \"healthCheckUrl\": \"http://USER-20171205YQ:8082/health\",\n" +
                "                        \"vipAddress\": \"test\",\n" +
                "                        \"secureVipAddress\": \"test\",\n" +
                "                        \"isCoordinatingDiscoveryServer\": \"false\",\n" +
                "                        \"lastUpdatedTimestamp\": \"1568186715013\",\n" +
                "                        \"lastDirtyTimestamp\": \"1568186713643\",\n" +
                "                        \"actionType\": \"ADDED\"\n" +
                "                    }\n" +
                "                ]\n" +
                "            }\n" +
                "        ]\n" +
                "    }\n" +
                "}", JsonApplications.class);

        System.out.println(jsonApplications.getApplications().getApplication().size());
        System.out.println(jsonApplications.getApplications().getApplication());
    }
}
